<?php
class Server {
  public static function delete_obj($orm) {
    $req = json_decode(Utils::get_param('req', '[]'));
    
    $pg_folder = PLGN_DIR . $req->folder . '/';
    if (file_exists($pg_folder)) {
      Utils::rrmdir($pg_folder);
    }

    $orm->delete('pb_plugin', $req);
    $opts = new stdClass();
    $opts->cd = 'plugin_id = :v1';
    $opts->cdv = array(':v1' => $req->id);
    $orm->delete_by_opts('pb_plugin_instance', $opts);
    echo json_encode($req);
  }
}
?>